<template>
  <div>
    <div class="project" v-if="!projectAddShow && !contractDtlShow">
      <!-- 筛选按钮 -->
      <div class="search-button">
        <el-button
          v-hasPermi="['system:taskProject:query']"
          class="btn search"
          @click="getProjectList"
          ><el-icon class="icon" color="#fff"> <Search /> </el-icon
          >查询</el-button
        >
        <el-button class="btn add" @click="handleRefresh"
          ><el-icon class="icon" color="#fff"> <Refresh /> </el-icon
          >重置</el-button
        >
        <el-popover :width="170" trigger="click" placement="bottom">
          <template #reference>
            <el-button class="btn search" style="width: 100px"
              ><el-icon class="icon" color="#fff"> <Setting /> </el-icon
              >显示列</el-button
            >
          </template>
          <el-checkbox-group v-model="checkList" @change="handleCheckChange">
            <div>
              <el-checkbox label="businessTypeName">任务类型</el-checkbox>
            </div>
            <div>
              <el-checkbox label="missionTypeName">子任务类型</el-checkbox>
            </div>
            <div>
              <el-checkbox label="serialName">关联项目/物料</el-checkbox>
            </div>
            <div>
              <el-checkbox label="serialNumber">项目/物料编号</el-checkbox>
            </div>
            <div>
              <el-checkbox label="startTime">计划开始时间</el-checkbox>
            </div>
            <div>
              <el-checkbox label="endTime">计划结束时间</el-checkbox>
            </div>

            <div>
              <el-checkbox label="createTime">分配时间</el-checkbox>
            </div>
            <div>
              <el-checkbox label="principal">责任人</el-checkbox>
            </div>
            <div>
              <el-checkbox label="missionStatusName">任务状态</el-checkbox>
            </div>
          </el-checkbox-group>
        </el-popover>
      </div>
      <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleTabClick">
        <!-- 筛选条件 -->
        <div class="search">
          <div class="search-item">
            <el-select
              v-model="params.businessType"
              placeholder="请选择任务类型"
              clearable
              class="search-input"
              @change="handleTaskType"
            >
              <el-option
                v-for="dict in checkListOptions"
                :key="dict.code"
                :label="dict.label"
                :value="dict.value"
                
              />
            </el-select>
          </div>
          <div class="search-item">
            <el-select
              v-model="params.subtaskType"
              placeholder="请选择子任务类型"
              clearable
              class="search-input"
            >
              <el-option
                v-for="dict in taskTypeList"
                :key="dict.code"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </div>
          <div class="search-item">
            <el-select
              v-model="params.projectCategory"
              placeholder="请选择项目种类"
              clearable
              class="search-input"
            >
              <el-option
                v-for="dict in kindList"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </div>
          <div class="search-item">
            <el-select
              v-model="params.projectType"
              placeholder="请选择项目类型"
              clearable
              class="search-input"
            >
              <el-option
                v-for="dict in typeList"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </div>
          <div class="search-item">
            <el-select
              v-model="params.projectStatus"
              placeholder="请选择项目状态"
              clearable
              class="search-input"
            >
              <el-option
                v-for="dict in statusList"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </div>
         
         
          <div class="search-item">
            <el-select
              v-model="params.userId"
              placeholder="请选择责任人"
              clearable
              class="search-input"
            >
              <el-option
                v-for="dict in userList"
                :key="dict.userId"
                :label="dict.nickName"
                :value="dict.userId"
              />
            </el-select>
          </div>
          <div class="search-item">
            <el-input
              clearable
              v-model.trim="params.projectNameOrCode"
              class="search-input"
              style="width:280px;"
              maxlength="30"
              placeholder="请输入项目名称/编号/物料查询"
            ></el-input>
          </div>
        </div>
        <el-tab-pane label="全部" name="first" class="demoYabs">
        </el-tab-pane>
        <el-tab-pane
          label="待受理"
          name="second"
          class="demoYabs"
        ></el-tab-pane>
        <el-tab-pane
          label="已受理"
          name="third"
          class="demoYabs"
        ></el-tab-pane>
        <el-tab-pane
          label="已完成"
          name="fourth"
          class="demoYabs"
        ></el-tab-pane>
        <el-tab-pane
          label="已退回"
          name="fifth"
          class="demoYabs"
        ></el-tab-pane>
      </el-tabs>
      <div class="tabinfo">
        <!-- 表格数据 -->
        <el-table
          v-loading="loading"
          :data="projectList"
          border
          height="51.2vh"
          :header-cell-style="{ 'text-align': 'center' }"
          @sort-change="sortChange"
        >
          <!-- 操作模式 -->
          <el-table-column
            label="操作"
            :show-overflow-tooltip="true"
            :width="'140px'"
          >
            <template #default="{ row }">
              <div class="table-operate">
                <el-icon
                  v-hasPermi="['system:taskProject:detail']"
                  title="查看详情"
                  color="#007CEF"
                  class="table-icon"
                  :size="20"
                  @click="handleOperate('detail', row)"
                >
                  <Document />
                </el-icon>
                <el-icon
                 v-if="row.execute == 1 && row.missionStatus === 0"
                    v-hasPermi="['system:taskProject:acceptance']"
                    title="受理"
                    color="#007CEF"
                    class="table-icon"
                    :size="20"
                    @click="handleOperate('acceptance', row)"
                >
                  <!-- <Notification /> -->
                  <img
                  src="@/assets/icons/images/accept.png"
                  style="width: 18px; height: 18px"
                />
                </el-icon>
                <el-icon
                 v-if="row.execute == 1&& row.missionStatus === 0"
                    v-hasPermi="['system:taskProject:back']"
                    title="退回"
                    color="#007CEF"
                    class="table-icon"
                    :size="20"
                    @click="handleOperate('back', row)"
                >
                  <!-- <Back /> -->
                  <img
                  src="@/assets/icons/images/back.png"
                  style="width: 18px; height: 18px"
                />
                </el-icon>
                <el-icon v-if="row.execute == 1&& row.missionStatus === 1"
                  title="办理" v-hasPermi="['system:taskProject:renewal']"
                  color="#007CEF"
                  class="table-icon"
                  :size="20"
                  @click="handleOperate('renewal', row)"
                >
                  <!-- <FirstAidKit /> -->
                  <img
                  src="@/assets/icons/images/manage.png"
                  style="width: 18px; height: 18px"
                />
                </el-icon>
              </div> </template
          ></el-table-column>
          <el-table-column
            type="index"
            label="序号"
            :index="indexMethod"
            width="70"
            align="center"
          />
          <el-table-column
            label="任务类型"
            prop="businessTypeName" v-if="checkList.includes('businessTypeName')"
            width="170"
            :show-overflow-tooltip="true"
            sortable="custom"
          />
          <!-- <el-table-column
            label="子任务类型(开发用)"
            prop="missionType"
            width="200"
            :show-overflow-tooltip="true"
            sortable="custom"
          /> -->
          <el-table-column
            label="子任务类型"
            prop="missionTypeName" v-if="checkList.includes('missionTypeName')"
            width="200"
            :show-overflow-tooltip="true"
            sortable="custom"
          />
          <el-table-column
            label="关联项目/物料" 
            prop="serialName" v-if="checkList.includes('serialName')"
            :show-overflow-tooltip="true"
            width="200"
            sortable="custom"
          />
          <el-table-column
            label="项目/物料编号"
            prop="serialNumber" v-if="checkList.includes('serialNumber')"
            :show-overflow-tooltip="true"
            width="200"
            sortable="custom"
          />
          <el-table-column
            label="计划开始时间"
            prop="startTime" v-if="checkList.includes('startTime')"
            :show-overflow-tooltip="true"
            width="180"
            sortable="custom"
          />
          <el-table-column
            label="计划结束时间"
            prop="endTime" v-if="checkList.includes('endTime')"
            :show-overflow-tooltip="true"
            width="180"
            sortable="custom"
          />
          <el-table-column
            label="分配时间"
            prop="createTime" v-if="checkList.includes('createTime')"
            :show-overflow-tooltip="true"
            width="140"
            sortable="custom"
          />
          <el-table-column
            label="责任人"
            prop="principal" v-if="checkList.includes('principal')"
            :show-overflow-tooltip="true"
            width="100"
          />
          <el-table-column
            label="任务状态"
            prop="missionStatusName" v-if="checkList.includes('missionStatusName')"
            :show-overflow-tooltip="true"
            width="100"
          />

         
        </el-table>

        <!-- 分页 -->
        <pagination
          class="pagination"
          :total="total"
          v-model:page="params.pageNum"
          v-model:limit="params.pageSize"
          @pagination="getProjectList"
        />
      </div>
    </div>

    <!-- 巡检弹窗 -->
    <el-dialog
      v-if="showPolling"
      :title="dialogTitle"
      v-model="showPolling"
      width="1600px"
      append-to-body
      class="dialogBox"
    >
      <ProjectAdd
        ref="showPollingRef"
        v-model:followAddShow="showPolling"
        :rowdata="rowdataPolling"
        @refreshList="getProjectList"
      />
      <template #footer>
        <!--  class="customer-info" -->
        <div class="dialog-footer">
          <el-button
            style="color: #fff; background-color: #007CEF"
            @click="handlePollingAdd(1)"
            >完 成</el-button
          >
          
      <el-button
        style="color: #fff; background-color: rgba(67, 207, 124, 1)"
        @click="handlePollingAdd(0)"
        >保 存</el-button
      >
      
     
          <el-button style="background-color: #fff" @click="handlePollingBack()"
            >取 消</el-button
          >
        </div>
      </template>
    </el-dialog>

    <ContractDtl
      ref="contractDtlRef"
      v-else
      v-if="contractDtlShow"
      v-model:contractDtlShow="contractDtlShow"
      @updateFollowAddShow="followAddShow = false"
      @refreshList="getProjectList"
      :pageType="pageType"
    />
    <el-dialog
      :title="dialogTitle"
      v-model="renewalAddShow"
      width="800px"
      append-to-body
    >
      <RenewalAdd
        v-if="renewalAddShow"
        ref="renewalAddRef"
        v-model:renewalAddShow="renewalAddShow"
        @refreshList="getProjectList"
        :pageType="pageType"
      />
    </el-dialog>

    <el-dialog
      title="项目启动会"
      v-model="followAddShow"
      width="800px"
      append-to-body
    >
      <FollowAdd
        v-if="followAddShow"
        ref="followAddRef"
        v-model:followAddShow="followAddShow"
        @refreshList="getProjectList"
        :pageType="pageType"
      />
    </el-dialog>

    <!-- 进度弹窗 -->
    <el-dialog
      title="任务分配"
      v-model="showschedule"
      width="1400px"
      append-to-body
      class="dialogBox"
    >
      <Schedule
        v-if="showschedule"
        ref="showscheduleRef"
        v-model:followAddShow="showschedule"
        :rowdata="rowdata"
      />
      <template #footer>
        <!--  class="customer-info" -->
        <div class="dialog-footer">
          <el-button
            style="color: #fff; background-color: rgba(67, 207, 124, 1)"
            @click="handlescheduleAdd"
            >保存</el-button
          >

          <el-button
            style="background-color: #fff"
            @click="handlescheduleBack()"
            >取 消</el-button
          >
        </div>
      </template>
    </el-dialog>

     <!--  工单受理  -->
     <el-dialog
        :title="'操作提示'"
        v-model="acceptanceShow"
        width="600px"
        append-to-body
    >
    <div style="display:flex;">
    <div>
      <img src="../../../assets/images/none-icon.png" style="width: 249px;
    height: 209px;" alt="">
    </div>
      <div>
        <div class="dialog-title-accep">
        确认受理该任务？
      </div>
      <div class="dialog-title2">受理后不可修改！</div>
      </div>
   </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button
              style="color: #fff; background-color: rgba(67, 207, 124, 1)"
              @click="saveCheck('followAdd')"
              v-loading="loadingCheck"
          >确 认</el-button
          >
          <el-button style="background-color: #fff" @click="acceptanceShow = false"
          >取 消</el-button
          >
        </div>
      </template>
    </el-dialog>

    <!--  工单退回  -->
    <el-dialog
        :title="'操作提示'"
        v-model="orderReturnShow"
        width="600px"
        append-to-body
    >
      <div class="dialog-title">
        <Warning
            style="width: 18px; height: 18px; margin-right: 8px; color: #d95700"
        />
        <span style="color: #d95700">任务退回后不可再进行操作！</span>
      </div>
      <!-- <el-form-item label="情况说明：" label-width="90"> -->
      <div style="display: flex">
        <div style="width: 100px">
          <span style="color: red">*</span> 退回原因：
        </div>
        <el-input
            style="width: 100%"
            v-model="auditRemark"
            placeholder="请填写"
            type="textarea"
            maxlength="500"
            clearable
            show-word-limit
        />
      </div>

      <template #footer>
        <div class="dialog-footer">
          <el-button
              style="color: #fff; background-color: rgba(67, 207, 124, 1)"
              @click="saveCheck('orderReturn')"
              v-loading="loadingCheck"
          >保存</el-button
          >
          <el-button style="background-color: #fff" @click="orderReturnShow = false"
          >取 消</el-button
          >
        </div>
      </template>
    </el-dialog>
    <!--  工单详情  -->
    <ProjectDetail
        v-if="workOrderDetailShow"
        ref="projectCheckRef"
        v-model:projectAddShow="workOrderDetailShow"
        @updateFollowAddShow="followAddShow = false"
    />
  </div>
</template>

<script setup>

import FollowAdd from "./followAdd.vue";
import RenewalAdd from "./renewalAdd.vue";
import ProjectAdd from "./projectAdd.vue";
import ContractDtl from "./dtl.vue";
import ProjectDetail from "@/views/operation/taskProject/projectDetail.vue";import Schedule from "./schedule";
import { getUserListApi } from "@/api/operation/work";

// import {
//   getOperateProjectListApi,
// } from "@/api/sales/project";
// import { getReadyProjectListApi } from "@/api/sales/marketing.js";
import { getProjectTaskListApi,taskBackApi,taskAcceptApi } from "@/api/operation/project";
import { getDictsApi,getTaskDictsApi } from "@/api/dict";
import { addTableHeaderApi, getTableHeaderApi } from "@/api/pub";
import { listDeptAll } from "@/api/system/dept";
import { ElMessage, ElMessageBox } from "element-plus";

const { proxy } = getCurrentInstance();
// 路由
const route = useRoute();
// 搜索参数
const params = reactive({
  subtaskType:null,
  businessType:null,
  deptId: null, // 所属部门
  projectCategory: null, // 项目种类
  projectType: null, // 	项目类型
  businessSchedule: null,
  guaranteeType: null, // 维保状态
  projectStatus: null, // 项目状态
  userId: null,
  projectNameOrCode: null, // 项目编号
  deptId: null, //所属公司
  includeContract: null, //是否签合同
  missionStatus: null, // （0:待受理;1:已受理 ;2:已完成 ;3:已退回 ）
  pageNum: 1,
  pageSize: 50,
  sortField: "",
  sortOrder: "",
});

const checkList = ref([
  "businessTypeName",
  "missionTypeName",
  "serialName",
  "serialNumber",
  "startTime",
  "endTime",
  "createTime",
  "principal",
  "missionStatusName",
]);

// 项目经理列表
let userList = ref([]);

const activeName = ref("first");
// 表格加载效果
const loading = ref(false);
// 项目新增组件显隐
const projectAddShow = ref(false);
// 跟进新增组件显隐
const followAddShow = ref(false);
const renewalAddShow = ref(false);
// 项目列表
const projectList = ref([]);
// 总数
const total = ref(0);
// 项目新增组件引用
const projectAddRef = ref(null);
// 跟进组件引用
const followAddRef = ref(null);
const renewalAddRef = ref(null);
// 操作类型
const pageType = ref("");
// 审核状态列表
const checkListOptions = ref([]);
// 是否签合同列表
const contractList = ref([]);
// 项目种类列表
const kindList = ref([]);
const taskTypeList = ref([]);
// 项目状态列表
const statusList = ref([]);
// 商务进度列表
const scheduleList = ref([]);
// 项目类型列表
const typeList = ref([]);
// 部门类型列表
const deptList = ref([]);

const contractDtlShow = ref(false);
const contractDtlRef = ref(null);
const dialogTitle = ref('任务执行')

// 工单受理弹窗
const acceptanceShow = ref(false);
const loadingCheck = ref(false);
// 工单退回
const orderReturnShow = ref(false);
// 退回原因
const auditRemark = ref('');
//进度详情的显隐
let showschedule = ref(false);

let rowdata = ref(null);
// 工单详情弹窗
const workOrderDetailShow = ref(false);
const projectCheckRef = ref();
// 处理进度保存
let showscheduleRef = ref(null);
const handlescheduleAdd = () => {
  showscheduleRef.value.handleraddbusSchedule();
};
const handlescheduleBack = () => {
  showschedule.value = false;
};
/**
 * @description: 获取用户列表
 */
const getUserList = async (id) => {
  await getUserListApi(2).then((res) => {
    if (res) {
      userList.value = res;
    }
  });
};

//进度详情的显隐
let showPolling = ref(false);

let rowdataPolling = ref(null);
// 处理进度保存
let showPollingRef = ref(null);
const handlePollingAdd = (type) => {
  showPollingRef.value.handleraddbusSchedule(type);
  
};
const handlePollingBack = () => {
  showPolling.value = false;
};
/**
 * @description: 复选框选中
 */
const handleCheckChange = async (val) => {
  var str = val.join(",");
  const result = await addTableHeaderApi({
    moduleType: 60,
    titleField: str,
  });
};

/**
 * @description: 获取表头
 */
const getTableHeader = async () => {
  const result = await getTableHeaderApi({
    moduleType: 60,
  });
  if (result.code == 200) {
    var arr = result.data.titleField.split(",");
    checkList.value = arr;
  }
};

/**
 * @description: 获取项目列表
 */
const getProjectList = async () => {
  try {
    loading.value = true;
    let { pageNum, pageSize } = params;
    let res = await getProjectTaskListApi({ pageNum, pageSize }, params);
    projectList.value = res.rows;
    total.value = res.total;
    loading.value = false;
  } catch {
    loading.value = false;
  }
};

/**
 * @description: 处理头部tab点击
 */
const handleTabClick = (tab)=>{
  switch (tab.props.name) {
    case 'first':
      params.missionStatus = null
      break;
      case 'second':
      params.missionStatus = 0
      break;
      case 'third':
      params.missionStatus = 1
      break;
      case 'fourth':
      params.missionStatus = 2
      break;
      case 'fifth':
      params.missionStatus = 3
      break;
    default:
      break;
  }
  console.log('处理头部tab点击')
  // console.log(type)
  // params.type = type;
  getProjectList()

}

/**
 * @description: 重置
 */
const handleRefresh = () => {
  Object.assign(params, {
    subtaskType:null,
  businessType:null,
    deptId: null, // 所属部门
    projectCategory: null, // 项目种类
    projectType: null, // 	项目类型
    businessSchedule: null,
    guaranteeType: null, // 维保状态
    projectStatus: null, // 项目状态
    userId: null,
    projectNameOrCode: null, // 项目编号
    deptId: null, //所属公司
    includeContract: null, //是否签合同
    type: null, // （0：预备项目；1：启动项目；2：施工项目；3：归档项目）
    pageNum: 1,
    pageSize: 50,
    sortField: "",
    sortOrder: "",
  });
  activeName.value = 'first'
  getProjectList();
};

/**
 * @description: 列表排序
 * @param {*} column.prop //当前排序取的字段
 * @param {*} column.order // "desc" "asc" 正序或倒序
 */
const sortChange = (column) => {
  params.sortField = column.prop;
  if (column.order === "descending") {
    params.sortOrder = "DESC"; // 排序或倒序
  } else {
    params.sortOrder = "ASC"; // 排序或倒序
  }
  getProjectList();
};
/**
 * @description: 表格操作
 * @param {String} type 类型
 * @param {Object} row  当前行数据
 */
 var acceptanceId = "";
const handleOperate = async (type, row) => {
  switch (type) {
    case "edit":
      rowdataPolling.value = row;
      pageType.value = type;
      showPolling.value = true;
      break;
    case "detail":
      // pageType.value = type;
      // contractDtlShow.value = true;
      // nextTick(() => {
      //   contractDtlRef.value.handleDetailInfo(row);
      //   // followAddRef.value.handleDetailInfo(row.projectId);
      // });
      console.log('row')
      console.log(row)
      workOrderDetailShow.value = true;
      nextTick(() => {
        projectCheckRef.value.handleDetailInfo(row.missionCenterId,row);
      })
      break;

    case "schedule":
      rowdata.value = row;
      pageType.value = type;
      showschedule.value = true;
      break;
    case "follow":
      pageType.value = type;
      followAddShow.value = true;

      nextTick(() => {
        followAddRef.value.handleDetailInfo(row);
      });
      break;

    case "renewal":
      console.log('dialogTitle')
      console.log(row)
      dialogTitle.value= row.missionTypeName
      //0:项目启动会,1:现场勘查,2:制定项目方案,3:配件/设备出库,4:现场安装/调试,
      //5:飞行验收,6:安装交付,7:设备拆装,8:工单任务办理,9:任务巡检,10:产品评估
      if(row.missionType == 1 || row.missionType == 4) {
        rowdataPolling.value = row;
      pageType.value = type;
      showPolling.value = true;
      }else {
        pageType.value = type;
        renewalAddShow.value = true;
  
        nextTick(() => {
          renewalAddRef.value.handleDetailInfo(row);
        });
      }
      break;
      case "acceptance": // 受理
      acceptanceShow.value = true;
      acceptanceId = row;
      break;
    case "back": // 退回
      orderReturnShow.value = true;
      auditRemark.value = "";
      acceptanceId = row;
      break;
    default:
      break;
  }
};

/**
 * @description: 处理任务变更
 */
const handleTaskType = async (value)=>{
  params.subtaskType = null
  checkListOptions.value.forEach(async item=>{
    if(item.value == value) {
await getTaskDictsApi({dictType:"erp_business_type",pidCode:item.code}).then((res) => {
    console.log('处理任务变更')
    console.log(res)
    // 任务
    if (res.code === 200) {
      taskTypeList.value = res.data;
    }
  });
    }
  })
  
}

/**
 * @description: 获取字典
 */
async function getDicts() {

  await getDictsApi("erp_business_type").then((res) => {
    // 审核状态
    if (res.code === 200) {
      checkListOptions.value = res.data;
    }
  });

  await getDictsApi("erp_project_guarantee_type").then((res) => {
    // 是否签合同
    if (res.code === 200) {
      contractList.value = res.data;
    }
  });
  await getDictsApi("erp_project_category").then((res) => {
    // 项目种类
    if (res.code === 200) {
      kindList.value = res.data;
    }
  });
  await getDictsApi("erp_project_new_status").then((res) => {
    // 项目状态
    if (res.code === 200) {
      statusList.value = res.data;
    }
  });
  await getDictsApi("erp_project_type").then((res) => {
    // 项目类型
    if (res.code === 200) {
      typeList.value = res.data;
    }
  });
  await getDictsApi("erp_business_schedule").then((res) => {
    // 商务进度
    if (res.code === 200) {
      scheduleList.value = res.data;
    }
  });
  //部门
  listDeptAll().then((response) => {
    deptList.value = proxy.handleTree(response.data, "deptId");
  });
}

/**
 * @description: 序号
 * @param {Number} index 索引
 */
function indexMethod(index) {
  const currentPage = params.pageNum;
  const pageSize = params.pageSize;
  const truelndex = (currentPage - 1) * pageSize + index + 1;
  return truelndex;
}

/*
* 工单受理弹窗保存
* */
const saveCheck = (type) => {
  delete acceptanceId.createTime;
  switch (type) {
    // acceptanceId.createTime = ''
    case 'followAdd':
      // loadingCheck.value = true;
      taskAcceptApi({...acceptanceId,missionStatus:1}).then(res => {
        if (res.code === 200) {
          ElMessage.success("操作成功");
          acceptanceShow.value = false;
          getProjectList();
          loadingCheck.value = false;
          orderReturnShow = false
        }
      })
      break;
    case 'orderReturn':
      if (auditRemark.value === null || auditRemark.value === "") {
        ElMessage.error("退回原因不能为空");
        return;
      }
      // loadingCheck.value = true;
      let params = {
        ...acceptanceId,
        missionStatus:3,
        returnReasons: auditRemark.value
      }
      taskBackApi(params).then(res => {
        if (res.code === 200) {
          ElMessage.success("操作成功");
          orderReturnShow.value = false;
          getProjectList();
          loadingCheck.value = false;
        }
      })
      break;
    default:
      break;
  }
}

onMounted(() => {
  getUserList();
  getTableHeader();
  // 路由携带项目id参数，直接显示详情页
  if (route.query?.projectId) {
    // let projectId = route.query.projectId;
    // pageType.value = "detail";
    // projectAddShow.value = true;
    // followAddShow.value = true;
    // nextTick(() => {
    //   projectAddRef.value.handleDetailInfo(projectId);
    //   followAddRef.value.handleDetailInfo(projectId);
    // });

    // pageType.value = type;
    contractDtlShow.value = true;
    nextTick(() => {
      contractDtlRef.value.handleDetailInfo({
        projectId: route.query.projectId,
      });
      // followAddRef.value.handleDetailInfo(row.projectId);
    });
  }
  // if (route.query?.businessId) {
  //   let applyId = route.query.businessId;
  //   if (
  //     route.query.checkStatus === "待审核" ||
  //     route.query.checkStatus === "审核中"
  //   ) {
  //     pageType.value = "check";
  //     projectAddShow.value = true;
  //     followAddShow.value = true;
  //     nextTick(() => {
  //       projectAddRef.value.handleDetailInfo(Number(applyId));
  //       followAddRef.value.handleDetailInfo(Number(applyId));
  //     });
  //   }
  // }
  // if (route.query?.myinfoId) {
  //   let applyId = route.query.myinfoId;

  //   pageType.value = "detail";
  //   projectAddShow.value = true;
  //   followAddShow.value = true;
  //   nextTick(() => {
  //     projectAddRef.value.handleDetailInfo(Number(applyId));
  //     followAddRef.value.handleDetailInfo(Number(applyId));
  //   });
  // }
  getProjectList();
  getDicts();
});
</script>
<style>
@import "@/assets/styles/confirmBtn.css";
.dialogBox .el-dialog__body {
  padding: 0px 20px !important;
}
</style>
<style lang="scss" scoped>
.project {
  padding: 20px;
  // width: 100%;
  // height: 100%;
  .search {
    flex-wrap: wrap;
    .search-item {
      margin-bottom: 10px;
    }
    .search-item:last-child {
      margin-bottom: 0px;
    }
  }
  .pagination {
    height: 60px;
    margin-top: 20px;
  }
}
.dialog-title-accep{
  margin-top:40px;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  padding-left: 20px;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
}
.dialog-title2{
  padding-left: 20px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 500;
}
.dialog-title {
  background-color: #fdefdc;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  padding-left: 20px;
  margin-bottom: 20px;
}
</style>
